<template>
    <van-nav-bar title="消费记录" left-text="" left-arrow @click-left="goBack" />
    <div>
        <div class="conter" v-for="item in consumelist">
            <div class="text">
                <p class="one">{{item.content}}</p>
                <p class="two">{{ item.createtime }}</p>
            </div>
        </div>
    </div>

</template>
<script setup>
import { onBeforeMount} from 'vue'
const goBack = () => {
    history.back();
};
const { cookies } = useCookies();
const consumelist = ref([]);
const LoginUser  = reactive(cookies.get('LoginUser') ?? {});

onBeforeMount(() => {//获取数据
    getConsumeData();
});

const getConsumeData = async () => {//获取数据
    let result = await Api.consume(
        {
            busid: LoginUser.id
        }
    )
    if(result.code == 1){
        consumelist.value = result.data;
    }

};


</script>
<style>
.conter {
    margin: 10px;
    border-top: 1px solid #ccc;
}

.text {
    display: flex;
    justify-content: space-around;
}
.one{
    width: 250px;
    overflow: hidden;
    font-size: 14px;
}
.two{
    display: flex;
    align-items: center;
}
</style>